//
//  CircleListrHeaderFooterView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/1.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "CircleListrHeaderFooterView.h"

@interface CircleListrHeaderFooterView()
{
    GLGWLabel *titleLab;
//    GLGWButton *firstBtn;
//    GLGWButton *secendBtn;
//    GLGWButton *thirdBtn;
//    GLGWButton *forthBtn;
    GLGWButton *moreNewsBtn;
}

@end

@implementation CircleListrHeaderFooterView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        GLGWView *view = [[GLGWView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(210)) inSuperView:self.contentView];
        view.backgroundColor = [UIColor whiteColor];
        
        CGFloat widthBackView = KScreenWidth - 2 * (kWidthProportion_In_iPhoneTriploid(15));
        GLGWView * backView = [[GLGWView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(20), widthBackView, kHeightProportion_In_iPhoneTriploid(188)) inSuperView:view];
        backView.backgroundColor = [UIColor whiteColor];
        [backView setViewShadowWidth:3.0 theCornerRadius:12.0];
        
        titleLab  = [[GLGWLabel alloc] initWithFrame:CGRectMake(0, kHeightProportion_In_iPhoneTriploid(5), backView.width, kHeightProportion_In_iPhoneTriploid(25)) theFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:backView];
        titleLab.textAlignment = NSTextAlignmentCenter;
        titleLab.text = @"广告到高手";
        
        CGFloat lineLeft = kWidthProportion_In_iPhoneTriploid(15);
        CGFloat lineWidth = backView.width - 2 * lineLeft;
        GLGWView * lineTopView = [[GLGWView alloc] initWithFrame:CGRectMake(lineLeft, kY_With_View(titleLab, 5), kWidthProportion_In_iPhoneTriploid(lineWidth), kHeightProportion_In_iPhoneTriploid(2)) inSuperView:backView];
        lineTopView.backgroundColor = [UIColor colorWithHexString:@"EAEAEA"];
        
        CGFloat butY = kY_With_View(lineTopView, 10);
        CGFloat heightBtn = kHeightProportion_In_iPhoneTriploid(18);
        CGFloat kMargin = kHeightProportion_In_iPhoneTriploid(5);
        UIImage *img = [UIImage imageWithColor:[UIColor redColor] size:CGSizeMake(3, 3)];
        for (int i = 0; i < 4; i ++) {
            GLGWButton *btn = [[GLGWButton alloc] initWithFrame:CGRectMake(lineLeft, butY + heightBtn * i + kMargin * i, lineWidth, heightBtn) inSuperView:backView];
            btn.tag = 414 + i;
            [btn setTitle:@"沙钢有望借壳上市"];
            btn.titleLabel.font = SYSTEMFONT(12);
            [btn setImage:img forState:UIControlStateNormal];
            [btn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
            //            [btn setImagePositionWithType:SSImagePositionTypeLeft spacing:kHeightProportion_In_iPhoneTriploid(13)];
            [btn setEdgeInsetsWithType:SSEdgeInsetsTypeImage marginType:SSMarginTypeLeft margin:kWidthProportion_In_iPhoneTriploid(50)];
            [btn setEdgeInsetsWithType:SSEdgeInsetsTypeTitle marginType:SSMarginTypeLeft margin:10];
        }
        
        GLGWView * lineBottomView = [[GLGWView alloc] initWithFrame:CGRectMake(lineLeft, kY_With_View(lineTopView, 100), lineWidth, kHeightProportion_In_iPhoneTriploid(2)) inSuperView:backView];
        lineBottomView.backgroundColor = [UIColor colorWithHexString:@"EAEAEA"];
        
        moreNewsBtn = [[GLGWButton alloc] initWithFrame:CGRectMake(0, kY_With_View(lineBottomView, 4), widthBackView, kHeightProportion_In_iPhoneTriploid(50)) inSuperView:backView];
        [moreNewsBtn setTitle:@"更多行情资讯>>"];
        moreNewsBtn.titleLabel.font = SYSTEMFONT(12);
        [moreNewsBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
        [moreNewsBtn addTarget:self action:@selector(moreAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

- (void)moreAction:(GLGWButton *)sender
{
    if (self.Block_Btn) {
        self.Block_Btn(sender);
    }
}

@end
